From 98bac62c0749786138b299d08e2c31db7d46421a Mon Sep 17 00:00:00 2001 From: Julian Laubstein Date: Tue, 10 Nov 2015 16:11:47 +0100 Subject: Added cChunkDef::IsValidHeight() --- src/ChunkDef.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ChunkDef.h b/src/ChunkDef.h index fcda9b5a6..c69f1fdf3 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -115,6 +115,12 @@ public: return Vector3i(a_RelBlockPosition.x + a_ChunkX * Width, a_RelBlockPosition.y, a_RelBlockPosition.z + a_ChunkZ * Width); } + /** Validates a height-coordinate. Returns false if height-coordiante is out of height bounds */ + inline static bool IsValidHeight(int a_Height) + { + return ((a_Height >= 0) && (a_Height < Height)); + } + /** Converts absolute block coords to chunk coords: */ inline static void BlockToChunk(int a_X, int a_Z, int & a_ChunkX, int & a_ChunkZ) -- cgit v1.2.3